#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2018/12/7 14:43
@desc
"""

import os
import configparser
from plogging import Plog

SECRET_KEY = 'ty@puton.info'
config = configparser.ConfigParser()
config_path = r'%s\%s' % (os.path.dirname(os.path.abspath(__file__)), 'config.ini')
config.read(config_path)
loggerLevel = config['DEFAULT']['logger.level']
loggerFormat = config['DEFAULT']['logger.ConversionPattern']
logFormatDict = {
    'standard_format': '[%(asctime)s][%(threadName)s:%(thread)d][task_id:%(name)s][%(filename)s:%(lineno)d]' \
                       '[%(levelname)s][%(message)s]',  # 其中name为getlogger指定的名字
    'simple_format': '[%(levelname)s][%(asctime)s][%(filename)s:%(lineno)d]%(message)s',
    'id_simple_format': '[%(levelname)s][%(asctime)s] %(message)s',
    'simple_format_info': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
}

log = Plog()
log.set_logger(when='D', limit=1, level=loggerLevel, filename='yyy.log', mode='w', fmt=logFormatDict[loggerFormat])
log = log.get_logger_instance()

if __name__ == '__main__':
    print(loggerLevel)
    log.info('1234556')
